*******************************************************************************
******************************  TABLE A18  ************************************
*****************  Converting Speaking Turns to Influence  ********************
*******************************************************************************
clear all
set more off

//cd "C:/Users/ganth/Dropbox/StrengthInNumbersReplicationPackage/replicable/table_a18"

*ssc install outreg2
*ssc install estout

********************************************************************************

**Study 1 Analysis
use "table_a18_dataset_1.dta", clear
eststo clear
eststo: reg minfl_votes_labavg speakingTurns female speakingTurnsXfemale if maleMajority, cluster(group_id_fall)
	estadd ysumm
eststo: reg minfl_votes_labavg speakingTurns female speakingTurnsXfemale if !maleMajority, cluster(group_id_fall)
		estadd ysumm


**Study 2 Analysis
use "table_a18_dataset_2.dta", clear

eststo: reg minfl_votes_labavg speakingTurns female speakingTurnsXfemale if maleMajority, cluster(group_id) 
		estadd ysumm
eststo: reg minfl_votes_labavg speakingTurns female speakingTurnsXfemale if !maleMajority & !allFemale, cluster(group_id) 
		estadd ysumm


**Combined Analysis
use "table_a18_dataset_3.dta", clear

eststo: reg minfl_votes_labavg speakingTurns female speakingTurnsXfemale if maleMajority, cluster(group_id) 
		estadd ysumm
eststo: reg minfl_votes_labavg speakingTurns female speakingTurnsXfemale if !maleMajority & !allFemale, cluster(group_id) 
		estadd ysumm

		
esttab _all using "table_a18.tex", style(tex) ///
 stats(N r2 ymean ysd, fmt( %9.0g %9.2f  %9.2f %9.2f) ///
labels("\$N$" "\$R^2$" "Mean of outcome" "St. dev. of outcome")) label replace ///
keep( speakingTurns female speakingTurnsXfemale) ///
star( * .1 ** .05 *** .01) b(%9.3f) se(%9.3f) nogaps  ///
mgroups("Study 1" "Study 2" "Studies 1 + 2", pattern(1 0 1 0 1 0) span prefix(\multicolumn{@span}{c}{) suffix(}) erepeat(\cmidrule(lr){@span})) ///
mtitles("\makecell{(1)\\Majority Male\\Group}" "\makecell{(2)\\Majority Female\\Group}" "\makecell{(3)\\Majority Male\\Group}" "\makecell{(4)\\Majority Female\\Group}" "\makecell{(5)\\Majority Male\\Group}" "\makecell{(6)\\Majority Female\\Group}") ///
nonotes nonum addnotes("\begin{minipage}{`linewidth'\linewidth} \footnotesize \smallskip \textbf{Note:} Table presents individual-level analysis. The dependent variable is the individual's average number of influence votes. Heteroskedasticity-robust group-clustered standard errors are reported in parentheses. Significance levels are indicated by $*$ $<.1$, ** $<.05$,  *** $<.01$.   \end{minipage}" )



clear
